package sample;

import java.awt.Color;
import java.io.IOException;

import robocode.HitRobotEvent;
import robocode.HitWallEvent;
import robocode.MessageEvent;
import robocode.Robot;
import robocode.TeamRobot;

/**
 * Robo Faz Nada<br />
 * sera controlado via Jason
 * 
 * @author Emerson Shigueo Sugimoto
 * @author Lucas Del Castanhel
 * */
public class RoboInimigo extends TeamRobot {
	public RoboInimigo() {
	}
	
	
	public void run() {
		setBodyColor(Color.ORANGE);
		setGunColor(Color.YELLOW);
		setRadarColor(Color.BLUE);
		setBulletColor(Color.green);
		setScanColor(Color.RED);
		
		 MensagemTime mensagem = new MensagemTime(getName(),getX(),getY(),true);
		 try {
				sendMessage("sample.RoboScanner", mensagem);
			} catch (IOException e) {
				e.printStackTrace();
			}
		
		while (true) {

			turnLeft(getHeading() % 90);
			turnGunRight(90);

			

			while (true) {
				turnRadarRight(360);
				turnRadarLeft(360);
				ahead(1000);
				turnRight(90);
			}
		}

		// while(true){
		// if (_listaAcoes != null && _listaAcoes.size() >= 2) {
		// executar();
		// } else {
		// // Sets the robot to move forward, backward or stop moving depending
		// // on the move direction and amount of pixels to move
		// setAhead(moveAmount * moveDirection);
		//
		// // Decrement the amount of pixels to move until we reach 0 pixels
		// // This way the robot will automatically stop if the mouse wheel
		// // has stopped it's rotation
		// moveAmount = Math.max(0, moveAmount - 1);
		//
		// // Sets the robot to turn right or turn left (at maximum speed) or
		// // stop turning depending on the turn direction
		// setTurnRight(45 * turnDirection); // degrees
		//
		// // Turns the gun toward the current aim coordinate (x,y) controlled
		// by
		// // the current mouse coordinate
		// double angle = normalAbsoluteAngle(Math.atan2(aimX - getX(), aimY -
		// getY()));
		//
		// setTurnGunRightRadians(normalRelativeAngle(angle -
		// getGunHeadingRadians()));
		//
		// // Fire the gun with the specified fire power, unless the fire power
		// = 0
		// if (firePower > 0) {
		// setFire(firePower);
		// }
		//
		// // Execute all pending set-statements
		// execute();
		//
		// // Next turn is processed in this loop..
		// }
		// }
	}

	@Override
	public void onHitRobot(HitRobotEvent e) {
		ahead(-10); // super.onHitRobot(e);
		turnLeft(20);
	}

	@Override
	public void onHitWall(HitWallEvent e) {
		// super.onHitWall(e);
		ahead(-10);
		turnLeft(20);
	}
}